package com.boshanam.model.dao;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.UsernameNotFoundException;

import com.boshanam.exceptions.domain.user.EmailIdAlreadyRegisteredException;
import com.boshanam.exceptions.domain.user.InvalidUserException;
import com.boshanam.exceptions.domain.user.UserAlreadyExistException;
import com.boshanam.exceptions.domain.user.UserNameAlreadyExistsException;
import com.boshanam.exceptions.domain.user.UserNotExistException;
import com.boshanam.model.entities.persistant.jpa.user.User;
import com.boshanam.model.vos.domain.user.UserVO;
import com.boshanam.model.vos.domain.user.UserVOImmutable;

/**
 * Interface for communication User information with back end.
 * 
 * 
 * @author Sivakumar Y IUserDao.java Dec 16, 2009 7:58:13 PM www.ibigbang.net
 *         shiva.forums@gmail.com
 */
public interface IUserDao {

	public void save(User user) throws UserAlreadyExistException,
			DataAccessException, UserNameAlreadyExistsException, EmailIdAlreadyRegisteredException;
	
	public UserVO updateUser(UserVO user) throws InvalidUserException,
	DataAccessException;

	void delete(User user) throws UserNotExistException, DataAccessException;

	List<UserVOImmutable> getAllUsers(int max);

	List<UserVOImmutable> getAllUsers();

	long getUserCount();

	
	public UserDetails loadUserByUsername(String username)
			throws UsernameNotFoundException, DataAccessException;

	UserVOImmutable getUserByEmail(String username) throws UsernameNotFoundException;

	UserVOImmutable getUserForId(String id) throws UserNotExistException;

}
